<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body>
    <div class="timo-detail-page">
        <div class="timo-detail-title">基本信息</div>
        <table class="layui-table timo-detail-table">
            <colgroup>
                <col width="100px"><col>
                <col width="100px"><col>
            </colgroup>
            <tbody>
                <tr>
                    <th>区域</th>
                    <td id="areaId" th:text="${shops.areaId}"></td>
                    <th>地址</th>
                    <td th:text="${shops.address}"></td>
                </tr>
                <tr>
                    <th>店铺名称</th>
                    <td th:text="${shops.shopName}"></td>
                    <th>店长</th>
                    <td id="user"></td>
                </tr>
                <tr>
                    <th>店铺类型</th>
                    <td th:text="${shopTypeName}"></td>
                    <th>联系人名称</th>
                    <td th:text="${shops.contactsName}"></td>
                </tr>
                <tr>
                    <th>电话</th>
                    <td th:text="${shops.phone}"></td>
                    <th>备用电话</th>
                    <td th:text="${shops.sparePhone}"></td>
                </tr>
                <tr>
                    <th>经度</th>
                    <td th:text="${shops.longitude}"></td>
                    <th>纬度</th>
                    <td th:text="${shops.latitude}"></td>
                </tr>
                <tr>
                    <th>营业状态</th>
                    <td th:text="${shops.openingStatus=='0'||shops.openingStatus==null?'营业中':'休息中'}"></td>
                    <th></th>
                    <td></td>
                </tr>
            </tbody>
        </table>
    </div>
<script th:replace="/common/template :: script"></script>
<script th:inline="javascript">
    layui.use(['jquery'], function () {
        var $ = layui.jquery;
        var areaId = $("#areaId").text();
        var areaIds = areaId.split(",");
        $.ajax({
            url: '/shopsService/shops/getMyAreaData/' + areaIds[areaIds.length-1],
            type: 'get',
            async : false,
            success: function (res) {
                $("#areaId").text(res.data[0].wholeName.replace(/，/g,""));
            }
        })
        var shopId = [[${shops.shopId}]]
        //获取店长
        $.ajax({
            url: '/shopsService/shops/getManager/'+shopId,
            type: 'get',
            async : false,
            success: function (res) {
                $("#user").text(res.data.phone?(res.data.nickName?res.data.nickName:res.data.phone+'(该用户暂无名称)'):'(暂无店长)')
            }
        })
    })
</script>
</body>
</html>